<template>
	<view class="resume_main_m">
		<p class="fontz fonts14 fontw700 resume_main_title flex jcsb aic">
			<text>{{data.title}}</text>
			<view class="flex aic" v-if="data.add" @click="add()">
				<image src="@/static/add.png" mode="" style="width: 16px;height: 16px;margin-right: 10px;"></image>
				<text style="color: #2F6CBC;">新增</text>
			</view>
		</p>
		<!-- 求职期望 -->
		<view v-if="data.id==0" class="resume_main_content flex jcsb aic" @click="change(datas.data)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text
						class="fonts14 fontz fontw500">{{dictFun(personalInformation.lookingForwardIndustry,"company_industry")}}</text>
					<text class="fonts12 fontz">{{dictFun(personalInformation.lookingForwardSalary,"salary")}}</text>
				</view>
				<view class="marginTop10">
					<p class="fonts12 fontz gray">{{dictFun(personalInformation.arrivalTime,"arrival_time")}}</p>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 工作经历 -->
		<view v-if="data.id==2" class="resume_main_content flex jcsb aic" v-for="(item,index) in workExperiences"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.companyName}}</text>
					<text
						class="fonts12 fontz ">{{timeFun(item.experienceStartTime)}}—{{timeFun(item.experienceEndTime) || "至今"}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{item.departmentName}}</text>
				</view>
				<view class="marginTop10">
					<p class="fonts12 fontz gray">工作内容：{{item.workDescription}}</p>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 教育经历 -->
		<view v-if="data.id==3" class="resume_main_content flex jcsb aic" v-for="(item,index) in educationExperiences"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.schoolName}}</text>
					<text
						class="fonts12 fontz ">{{timeFun(item.experienceStartTime)}}—{{timeFun(item.experienceEndTime)}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{dictFun(item.educationLevel,"education")}}</text>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 项目经历 -->
		<view v-if="data.id==4" class="resume_main_content flex jcsb aic" v-for="(item,index) in projectExperiences"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.projectName}}</text>
					<text
						class="fonts12 fontz ">{{timeFun(item.experienceStartTime)}}—{{timeFun(item.experienceEndTime) || "至今"}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{item.positionName}}</text>
				</view>
				<view class="marginTop10">
					<p class="fonts12 fontz gray">项目描述：{{item.projectDescription}}</p>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 培训经历 -->
		<view v-if="data.id==5" class="resume_main_content flex jcsb aic" v-for="(item,index) in trainingExperiences"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.experienceName}}</text>
					<text
						class="fonts12 fontz ">{{timeFun(item.experienceStartTime)}}—{{timeFun(item.experienceEndTime) || "至今"}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{item.experienceDirections}}</text>
				</view>
				<view class="marginTop10">
					<p class="fonts12 fontz gray">培训课程：{{item.experienceDescription}}</p>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 专业技能 -->
		<view v-if="data.id==6" class="resume_main_content flex jcsb aic" v-for="(item,index) in skills"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.skillName}}</text>
					<text class="fonts12 fontz ">{{timeFun(item.masterTime)}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{dictFun(item.proficiencyLevel,"proficiency_level")}}</text>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 资格证书 -->
		<view v-if="data.id==7" class="resume_main_content flex jcsb aic" v-for="(item,index) in certificates"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.certificateName}}</text>
					<text class="fonts12 fontz ">{{timeFun(item.issuanceTime)}}</text>
				</view>
				<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{item.issuanceUnit}}</text>
				</view>
				<!-- <view class="marginTop10">
					<p class="fonts12 fontz gray">证书描述：{{item.certificateDescription}}</p>
				</view> -->
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 自我评价 -->
		<view v-if="data.id==1" class="resume_main_content flex jcsb aic" @click="change(datas.data)">
			<view class="">
				<p class="fonts12 fontz gray">{{selfEvaluation}}</p>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		
		<!-- 奖惩情况 -->
		<view v-if="data.id==10" class="resume_main_content flex jcsb aic" @click="change(datas.data)">
			<view class="">
				<p class="fonts12 fontz gray">{{performanceRewardsPunishments}}</p>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		
		
		<!-- 家庭主要成员及重要社会关系 -->
		<view v-if="data.id==8" class="resume_main_content flex jcsb aic" v-for="(item,index) in familyMembers"
			@click="changes(datas.data,index)">
			<view class="" style="width: calc(100% - 29px);">
				<view class="flex jcsb">
					<text class="fonts14 fontz fontw500">{{item.title}}</text>
					<!-- <text class="fonts12 fontz ">{{timeFun(item.issuanceTime)}}</text> -->
				</view>
			<!-- 	<view class="flex jcsb marginTop10">
					<text class="fonts14 fontz fontw500">{{item.issuanceUnit}}</text>
				</view> -->
				<view class="marginTop10">
					<p class="fonts12 fontz gray">姓名：{{item.fullName}}</p>
				</view>
			</view>
			<view class="">
				<image src="@/static/icon／arrow-right.png" mode="" style="width: 20px;height: 20px;"></image>
			</view>
		</view>
		<!-- 个人承诺 -->
		<view class="" v-if="data.id==9" style="margin-top: 14px;">
			<p class="fontz fonts12">{{selfCommitment}}</p>
		</view>
	</view>
</template>

<script>
	import {
		dictFuns
	} from "@/util/dictionary"
	export default {
		name: "Myresume",
		props: ["data"],
		data() {
			return {
				performanceRewardsPunishments: "",
				selfEvaluation: "",
				selfCommitment: "",
				datas: {},
				personalInformation: {},
				workExperiences: [],
				projectExperiences: [],
				trainingExperiences: [],
				skills: [],
				educationExperiences: [],
				certificates: [],
				familyMembers: []
			}
		},
		watch: {
			data: {
				handler(newVal, oldVal) {
					// console.log('newVal:', newVal)
					this.datas = newVal
					switch (newVal.id) {
						case 0: //求职期望
							if (newVal.data.personalInformation) {
								this.personalInformation = newVal.data.personalInformation
							}
							break;
						case 1: //自我评价
							if (newVal.data.personalInformation) {
								this.selfEvaluation = newVal.data.personalInformation.selfEvaluation
							}
							break;
						case 2: //工作经历
							this.workExperiences = newVal.data.workExperiences||[]
							// console.log("工作经历", this.workExperiences);
							break;

						case 3: //教育经历
							this.educationExperiences = newVal.data.educationExperiences||[]
							// console.log("教育经历", this.educationExperiences);
							break;
						case 4: //项目经历
							this.projectExperiences = newVal.data.projectExperiences||[]
							// console.log("项目经历", this.projectExperiences);
							break;
						case 5: //培训经历
							this.trainingExperiences = newVal.data.trainingExperiences||[]
							// console.log("培训经历", this.trainingExperiences);
							break;
						case 6: //专业技能
							this.skills = newVal.data.skills||[]
							// console.log("专业技能", this.skills);
							break;
						case 7: //资格证书
							this.certificates = newVal.data.certificates||[]
							// console.log("资格证书", this.certificates);
							break;
						case 8: //家庭主要成员及重要社会关系
							this.familyMembers = newVal.data.familyMembers||[]
							// console.log("家庭", this.familyMembers);
							break;
						case 9: //本人承诺
							if (newVal.data.personalInformation) {
								this.selfCommitment = newVal.data.personalInformation.selfCommitment
							}
							this.selfCommitment ="本人郑重承诺：本人向香城英才网提供应聘简历、身份信息、教育经历、工作履历、证书证件等个人信息完全真实可靠，不存在弄虚作假情况。如证实本人提供的个人信息存在虚假情况，本人愿意承担相应的法律责任。"
							break;
						case 10: //业绩及奖惩情况
							if (newVal.data.personalInformation) {
								this.performanceRewardsPunishments = newVal.data.personalInformation.performanceRewardsPunishments
							}
							break;
					}

				},
				immediate: true,
				deep: true
			},
		},
		methods: {
			add() {
				uni.navigateTo({
					url: this.data.url + "?type=1&data=" + JSON.stringify(this.datas.data)
				})
			},
			change(item) {
				uni.navigateTo({
					url: this.data.url + "?data=" + JSON.stringify(item)
				})
			},
			changes(item, index) {
				uni.navigateTo({
					url: this.data.url + "?type=0&data=" + JSON.stringify(item) + "&index=" + index
				})
			},
			dictFun(value, res) {
				// console.log(value, res);
				return dictFuns(value, res)
			},
			timeFun(res) {
				if (res) {
					return res.slice(0, 7)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.resume_main_title {
		position: relative;
		padding-left: 10px;

		&::after {
			position: absolute;
			left: 0;
			top: 2px;
			content: "";
			width: 4px;
			height: 16px;
			background: #2F6CBC;
			border-radius: 0px 2px 2px 0px;
			opacity: 1;
		}
	}

	.resume_main_content {
		margin-top: 8px;
		padding: 12px;
		background: #FFFFFF;
		border-radius: 8px 8px 8px 8px;
		opacity: 1;
		border: 1px solid #2F6CBC;
	}
</style>
